package com.example.day07_zhongji.model;

import com.example.day07_zhongji.base.BaseModel;
import com.example.day07_zhongji.base.BaseObserver;
import com.example.day07_zhongji.bean.ListBean;
import com.example.day07_zhongji.not.ApiService;
import com.example.day07_zhongji.not.HttpUlist;
import com.example.day07_zhongji.not.RxUlist;

import io.reactivex.Observable;

public class ListModel extends BaseModel {
    public void listdata(ListCallBack callBack,int cid){
        ApiService apiServer = new HttpUlist().getApiServer(ApiService.list, ApiService.class);
        Observable<ListBean> getdata = apiServer.getdata(1, cid);
        getdata.compose(RxUlist.ReObservableTransformer())
                .subscribe(new BaseObserver<ListBean>(this) {
                    @Override
                    protected void onSuccess(ListBean listBean) {
                        callBack.onSuccess(listBean);
                    }

                    @Override
                    protected void onFali(String message) {
                        callBack.onFali(message);
                    }
                });
    }
}
